﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Collections.ObjectModel;

namespace HolisticWare.VoIP.Getafisk.DLL_02BL_netfx35
{
	public
		partial
		class 
		Extension
	{

		static
			public
			ObservableCollection<Extension>
			Extensions
			(
			)
		{
			ObservableCollection<Extension> extensions;
			extensions = new ObservableCollection<Extension>();

			bool webswervice_available = false;
			if (webswervice_available)
			{
				extensions = ExtensionsFromWebService();
			}
			else
			{
				extensions = ExtensionsFake();
			}

			return extensions;
		}

			static
			public
			ObservableCollection<Extension>
			ExtensionsFake
			(
			)
		{
			ObservableCollection<Extension> extensions;
			extensions = new ObservableCollection<Extension>();
			string format;
			

			int data_count = 10;
			for (int i = 1; i <= data_count; i++)
			{
				DateTime dt_timestamp = DateTime.Now;
				//format = "yyyy-MM-dd-HH-mm-ss";
				format = "ffffff";					// miliseconds parts
				string timestamp = dt_timestamp.ToString(format);
				Extension e = new Extension()
				{
				  AliasCID = "AliasCID " + timestamp
				, CallScreening = true
				, CallWaiting = true
				, CIDEmergency = "AliasCID " + timestamp
				, DIDCIDCollection = new DIDCIDs().TestDebug
				, DisplayName = "DisplayName " + timestamp
				, AliasSIP = "AliasSIP " + timestamp
				, ExtensionNumber = 1000 + i
				, OutboundCID = "OutboundCID " + timestamp
				, RingTime = 10
				, Secret = 1000 + i
				};
				extensions.Add(e);
			} // end for

			for (int i = 1; i <= data_count; i++)
			{
				DateTime dt_timestamp = DateTime.Now;
				//format = "yyyy-MM-dd-HH-mm-ss";
				format = "ffffff";					// miliseconds parts
				string timestamp = dt_timestamp.ToString(format);
				Extension e = new ExtensionIAX2()
				{
				  AliasCID = "AliasCID " + timestamp
				, CallScreening = true
				, CallWaiting = true
				, CIDEmergency = "AliasCID " + timestamp
				, DIDCIDCollection = new DIDCIDs().TestDebug
				, DisplayName = "DisplayName " + timestamp
				, AliasSIP = "AliasSIP " + timestamp
				, ExtensionNumber = 1000 + i
				, OutboundCID = "OutboundCID " + timestamp
				, RingTime = 10
				, Secret = 1000 + i
				};
				extensions.Add(e);
			} // end for

			return extensions;
		}

		static
			public
			ObservableCollection<Extension>
			ExtensionsFromWebService
			(
			)
		{
			ObservableCollection<Extension> extensions;
			extensions = new ObservableCollection<Extension>();

			return extensions;
		}
	}
}
